import React, { Component} from 'react'
import {Provider} from './context'
class Father extends Component{

    render(){
       
        return <div className="father">
            爸爸
            <Son></Son>
        </div>
    }
}

class TwoFather extends Component{

    render(){
       
        return <div className="father">
            二爸爸
            <Father></Father>
        </div>
    }
}

class GrandFather extends Component{
    state={
        name:'顺溜'
    }

    setName = name => this.setState({name})
    
    render(){
        return <Provider value={{name:this.state.name, setName:this.setName }}>
            <div className="grandFather">
                爷爷
                <TwoFather></TwoFather>
            </div>
        </Provider> 
    }
}

export default GrandFather